/* global.css */
:root {
    /* 白天模式颜色变量 */
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-color: #333333;
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --border-color: #e0e0e0;
    --input-bg: #ffffff;
    --icon-color: #666666;
    --error-color: #e63946;
    --success-color: #2a9d8f;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --hover-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
}

.dark-theme {
    /* 夜间模式颜色变量 */
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-color: #e0e0e0;
    --primary-color: #4895ef;
    --secondary-color: #4361ee;
    --border-color: #333333;
    --input-bg: #2d2d2d;
    --icon-color: #a0a0a0;
    --error-color: #ff6b6b;
    --success-color: #4cc9f0;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --hover-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}

/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s ease,
    color 0.3s ease,
    border-color 0.3s ease;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

/* 主题切换组件 */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1000;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider.round {
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* 通用容器样式 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 基础表单元素 */
input, button, textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

/* 通用动画 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(20px); }
    to { transform: translateY(0); }
}


.custom-alert {
    position: fixed;
    top: 20px;
    right: -320px;
    width: 300px;
    background: var(--card-bg);
    border-left: 4px solid;
    border-radius: 8px;
    box-shadow: var(--hover-shadow);
    transition: right 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    z-index: 1000;
}

.custom-alert.show {
    right: 20px;
}

.alert-content {
    padding: 15px 20px;
    display: flex;
    align-items: center;
    position: relative;
}

.alert-icon {
    width: 24px;
    height: 24px;
    margin-right: 15px;
    background-size: contain;
}

.alert-message {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
    color: var(--text-color);
}

.alert-close {
    background: none;
    border: none;
    color: var(--icon-color);
    font-size: 18px;
    cursor: pointer;
    margin-left: 10px;
    transition: color 0.3s;
}

.alert-close:hover {
    color: var(--primary-color);
}

/* 状态图标 */
.alert-success {
    border-color: var(--success-color);
}
.alert-success .alert-icon {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%232a9d8f"><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/></svg>');
}

.alert-error {
    border-color: var(--error-color);
}
.alert-error .alert-icon {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23e63946"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>');
}

.alert-info {
    border-color: var(--primary-color);
}
.alert-info .alert-icon {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%234361ee"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"/></svg>');
}
